package chapter02
import scala.collection.mutable.ArrayBuffer
object Test15_Array2 {
  def main(args: Array[String]): Unit = {
    //可变数组 插入和删除ArrayBuffer
    //定义一个数组
    var buffer = ArrayBuffer[Int](1,2,3)
    //更新值
    buffer(0) = 20
    println(buffer.mkString(","))
    //使用函数的方式
    buffer.update(2,30)
    println(buffer.mkString(","))
    //增加元素
    buffer.append(10,12,14)
    println(buffer.mkString(","))
    buffer.insert(1,100,200)
    println(buffer.mkString(","))
    //删除元素
    buffer.remove(0,2)
    println(buffer.mkString(","))
  }
}
